package com.api.wall.getchildevents;

import java.util.List;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.test.context.ContextConfiguration;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

import com.api.test.AbstractApiTest;
import com.zyncro.api.IWallApiService;
import com.zyncro.api.exceptions.ZyncroApiException;
import com.zyncro.api.model.CollectionResultApi;
import com.zyncro.api.model.EventApi;

@ContextConfiguration(locations = { "classpath:/wall/wall-static.xml" })
public class GetChildEvents extends AbstractApiTest {

	@Value("#{group_toGetComments[participant].appId}")
	private String userUrn;

	@Value("#{group_toGetComments[participant].password}")
	private String userPassword;

	@Value("#{group_toGetComments.eventUrn}")
	private String eventUrn;

	@Value("#{group_toGetComments.totalFeeds}")
	private int totalFeeds;

	@BeforeClass
	protected void setParameters() throws Exception {

		getApi().login(userUrn, userPassword);
	}

	@Test
	public void testGetComments() throws ZyncroApiException {

		boolean includeHtml = false;
		List<String> users = null;

		String idlastevent = null;
		int items = 0;

		boolean includeProperties = false;

		CollectionResultApi<EventApi> result = getApi().getService(IWallApiService.class).getChildEvents(eventUrn, idlastevent, items,
				includeHtml, includeProperties, users);

		Assert.assertEquals(result.getElements().size(), totalFeeds, "Total comment feeds");
	}
}
